package com.explorati.interview.interview.chapternine;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MethodTest {

	public static void main(String[] args) {
		try {
			Class<MethodTestClass> clazz = MethodTestClass.class;
			Method method = clazz.getDeclaredMethod("m2");
			MethodTestClass obj = clazz.newInstance();
			// obj.m2();
			method.invoke(obj);
			MethodTestClass obj1 = (MethodTestClass) Class
					.forName("com.explorati.interview.interview.chapternine.MethodTestClass").newInstance();
			obj1.m1();
			// MethodTestClass instance = (MethodTestClass)
			// Class.forName("MethodTestClass").newInstance();
			// instance.m2();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
